package com.codebuffer;

import java.util.*;

public class IsContinuous {
    public static boolean IsContinuous(int [] numbers) {
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        Set set = new HashSet<>();
        for (int j = 0; j < numbers.length; j++) {
            if(numbers[j]==0) continue;
            if(set.contains(numbers[j]))return false;
            max = Math.max(numbers[j],max);
            min = Math.min(numbers[j],min);
            set.add(numbers[j]);
        }
        if(max - min < 5){
            return true;
        }
        return false;
    }

    public static void main(String[] args) {
        IsContinuous(new int[]{1,3,2,6,4});
    }
}
